<%-- 
    Document   : viewOrders
    Created on : Sep 23, 2013, 12:02:49 PM
    Author     : Thai Ha Cong
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="description" content="Member Profile - Online Shopping System">
        <title>Member Profile - Online Shopping System</title>
        <link href="<%= request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
        <div class="headerbg">
            <%@include file="/include/iHeader.jsp" %>
        </div>
        <div class="contentbg">
            <s:if test="%{#session.currentCustomer == null}">
                <% response.sendRedirect(request.getContextPath() + "/home");%>
            </s:if>
            <s:else>
                <div class="content1">
                    <div class="content2">
                        <div class="contentLeft">
                            <div class="categories">
                                <div class="allCat">Control Panel</div>

                                <%@include file="/include/iProfileMenu.jsp" %>
                            </div>
                        </div>
                        <div class="contentRight">
                            <div class="body">
                                <div class="breadcrumb">
                                    <s:url namespace="/" action="home" var="homeUrl"></s:url>
                                    <s:url namespace="/Member" action="viewProfile" var="memberUrl"></s:url>

                                    <s:a href="%{homeUrl}" title="Home" theme="simple">Home</s:a>
                                        >>
                                    <s:a href="%{memberUrl}" title="Member" theme="simple">Member Profile</s:a>
                                        >>
                                        View Orders
                                    </div>
                                    <div class="bodyUpper">
                                    <s:actionmessage />
                                    <h1>Your Orders List</h1>

                                    <table class="orderData">
                                        <tr>
                                            <th class="">Order ID</th>
                                            <th class="">Time</th>
                                            <th class="">Total Quantity</th>
                                            <th class="">Total Amount</th>
                                            <th class="">Order Status</th>
                                            <th class="">Details</th>
                                        </tr>

                                        <s:iterator value="orderList" status="i">
                                            <s:if test="#i.index % 2 == 1">
                                                <tr class="evenRow">
                                                    <td class="oOrderID">
                                                        <s:property value="idOrder"/>
                                                    </td>
                                                    <td class="oTime">
                                                        <s:date name="createTime" format="MM/dd/yy hh:mm:ss"/>
                                                    </td>
                                                    <td class="oQuantity">
                                                        <s:property value="totalQuantity"/>
                                                    </td>
                                                    <td class="oAmount">
                                                        <s:property value="%{getText('{0,number,¤##0.00}',{totalAmount})}"/>
                                                    </td>
                                                    <td class="oStatus">
                                                        <s:property value="orderStatus"/>
                                                    </td>
                                                    <td class="oDetails">
                                                        <s:if test="%{!orderStatus.equals('Cancelled')}">
                                                            <s:form namespace="/Member" action="viewOrderDetails" theme="simple">
                                                                <s:hidden name="idOrder" value="%{idOrder}"></s:hidden>
                                                                <s:submit value="View" title="View this Order Details" theme="simple"/>
                                                            </s:form>
                                                        </s:if>
                                                    </td>
                                                </tr>
                                            </s:if>
                                            <s:else>
                                                <tr class="oddRow">
                                                    <td class="oOrderID">
                                                        <s:property value="idOrder"/>
                                                    </td>
                                                    <td class="oTime">
                                                        <s:date name="createTime" format="MM/dd/yy hh:mm:ss"/>
                                                    </td>
                                                    <td class="oQuantity">
                                                        <s:property value="totalQuantity"/>
                                                    </td>
                                                    <td class="oAmount">
                                                        <s:property value="%{getText('{0,number,¤##0.00}',{totalAmount})}"/>
                                                    </td>
                                                    <td class="oStatus">
                                                        <s:property value="OrderStatus"/>
                                                    </td>
                                                    <td class="oDetails">
                                                        <s:if test="%{!orderStatus.equals('Cancelled')}">
                                                            <s:form namespace="/Member" action="viewOrderDetails" theme="simple">
                                                                <s:hidden name="idOrder" value="%{idOrder}"></s:hidden>
                                                                <s:submit value="View" title="View this Order Details" theme="simple"/>
                                                            </s:form>
                                                        </s:if>
                                                    </td>
                                                </tr>
                                            </s:else>
                                        </s:iterator>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </s:else>
        </div>
        <div class="footerbg">
            <%@include file="/include/iFooter.jsp" %>
        </div>
    </body>
</html>
